package cn.com.webtools.service.impl;

import cn.com.webtools.service.IPPIService;

/**
 * PPI实现类
 * @author lmq <br />
 * 2016年11月24日
 * @version 1.0
 * @since 1.0
 */
public class PPIServiceImpl implements IPPIService {

	@Override
	public double compute(double screenHeight, double screenWidth, double screenSize) {
		if(screenHeight <= 0 || screenWidth <= 0 || screenSize <= 0) {
			throw new IllegalArgumentException("传入参数错误");
		}
		double sqrH = screenHeight * screenHeight;
		double sqrW = screenWidth * screenWidth;
		double sqrtValue = Math.sqrt(sqrH+sqrW);
		double ppi = sqrtValue/screenSize;
		return ppi;
	}
}
